/**
 * Copyright (c) 2013 onionframework.org
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 */
package org.onionframework.servlet;

import javax.servlet.Servlet;

public class ServletDelegate {

	private Servlet target;
	private String urlPatterns[];

	/**
	 * @return the target
	 */
	public Servlet getTarget() {
		return target;
	}

	/**
	 * @param target the target to set
	 */
	public void setTarget(Servlet target) {
		this.target = target;
	}

	/**
	 * @return the pattern
	 */
	public String[] getUrlPatterns() {
		return urlPatterns;
	}

	public void setUrlPatterns(String[] urlPatterns) {
		this.urlPatterns = urlPatterns;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((urlPatterns == null) ? 0 : urlPatterns.hashCode());
		result = prime * result + ((target == null) ? 0 : target.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ServletDelegate other = (ServletDelegate) obj;
		if (urlPatterns == null) {
			if (other.urlPatterns != null)
				return false;
		} else if (!urlPatterns.equals(other.urlPatterns))
			return false;
		if (target == null) {
			if (other.target != null)
				return false;
		} else if (!target.equals(other.target))
			return false;
		return true;
	}
}
